/* GUI CONVERTED from rwopmmt.p (converter v1.75) Sat Aug 12 23:17:39 2000 */
/* rwopmmt.p - STANDARD OPERATION MAINTENANCE                           */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 4.0      LAST MODIFIED: 03/18/88   BY: WUG *A194*/
/* REVISION: 5.0      LAST MODIFIED: 07/06/89   BY: emb *B169*/
/* REVISION: 6.0      LAST MODIFIED: 07/17/92   BY: emb *F778*/
/* REVISION: 7.3      LAST MODIFIED: 11/10/92   BY: emb *G689*/
/* REVISION: 7.3      LAST EDIT:     02/24/93   BY: sas *G740**/
/* REVISION: 7.3      LAST EDIT:     06/02/93   BY: dzs *GB32**/
/* Oracle changes (share-locks)    09/13/94           BY: rwl *GM49*    */
/* REVISION: 8.5      LAST MODIFIED: 01/13/96   BY: *J04C* Sue Poland   */
/* REVISION: 8.5      LAST MODIFIED: 02/22/96   BY: *G1MB* Sue Poland   */

/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E     LAST MODIFIED: 07/29/98   BY: *J2V1* Rajesh Talele*/
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb              */
     /* DISPLAY TITLE */
     {mfdtitle.i "b+ "} /*GB32*/

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rwopmmt_p_1 "Comments"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

     define            variable description like pt_desc1.
     define            variable del-yn      like mfc_logical
                       initial no.
     define            variable opmcmmts    like mfc_logical
                       initial no label {&rwopmmt_p_1}.
     define new shared variable cmtindx     as integer.

     /* DISPLAY SELECTION FORM */
     
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
        
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
opm_std_op     colon 30
        opm_desc       colon 30
        opm_wkctr      colon 30
        opm_mch        colon 30
        skip(1)
        opm_setup      colon 30
        opm_run        colon 30
        opm_move       colon 30
        skip(1)
        opm_yld_pct    colon 30
        opm_tool       colon 30
        opm_vend       colon 30
/*G689*/    opm_mile       colon 30
/*GB32      skip(1)                      */
/*GB32*/    opm_inv_val    colon 30
        opm_sub_cost   colon 30
        opm_sub_lead   colon 30
        opm_tran_qty   colon 30
        opmcmmts       colon 30
      SKIP(.4)  /*GUI*/
with frame a width 80 side-labels attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



     /* SET EXTERNAL LABELS */
     setFrameLabels(frame a:handle).

     /* DISPLAY */
     view frame a.

     mainloop:
     repeat with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.


        prompt-for opm_std_op editing:
           /* FIND NEXT/PREVIOUS RECORD */
/*J04C*        {mfnp05.i opm_mstr opm_std_op yes opm_std_op "input opm_std_op"} */
           /* NEXT/PREV THROUGH ONLY THE NON-SERVICE OPERATIONS */
/*J04C*/       {mfnp05.i opm_mstr opm_std_op "opm_fsm_type = "" "" "
             opm_std_op "input opm_std_op"}

           if recno <> ? then do:
          display
             opm_std_op opm_desc opm_wkctr opm_mch
             opm_setup opm_run opm_move
             opm_yld_pct opm_tool opm_vend
/*G689*/             opm_mile
/*GB32*/             opm_inv_val
             opm_sub_cost opm_sub_lead opm_tran_qty.
             if opm_cmtindx <> 0 then display yes @ opmcmmts.
             else display no @ opmcmmts.
           end.
        end.

        /* ADD/MOD/DELETE */
/*F778*     find opm_mstr using opm_std_op no-error. */
/*F778*/    find opm_mstr where opm_std_op = input opm_std_op no-error.
        if not available opm_mstr then do:
/*G1MB*        ADDED THE FOLLOWING */
           /* DON'T LET THE USER CREATE BLANK STANDARD OPERATIONS */
           if input opm_std_op = " " then do:
            {mfmsg.i 40 3}
            /* BLANK NOT ALLOWED */
            undo, retry.
           end. /* if input opm_std_op = " " */
/*G1MB*        END ADDED CODE */
           {mfmsg.i 1 1}
           create opm_mstr.
           assign opm_std_op.
/*G689*/       opm_mile = yes.
           opmcmmts = no.
        end.
/*G740*/    else do:
/*J04C*        WITH 8.5, REMOVED RELIANCE ON QAD_WKFL */
/*J04C* /*G740*/      {fsopmv.i opm_std_op 2} */
/*J04C*/       if opm_fsm_type <> " " then do:
/*J04C*/       {mfmsg.i 7492 2}
           /* CONTROLLED BY SERVICE/SUPPORT MODULE */
/*J04C*/       end. /* if opm_fsm_type... */
/*G740*/    end.

        recno = recid(opm_mstr).
        ststatus = stline[2].
        status input ststatus.
        del-yn = no.

        if opm_cmtindx <> 0 then opmcmmts = yes.
        else opmcmmts = no.

        display
           opm_desc opm_wkctr opm_mch
           opm_setup opm_run opm_move
           opm_yld_pct opm_tool opm_vend
/*G689*/       opm_mile
/*GB32*/       opm_inv_val
           opm_sub_cost opm_sub_lead opm_tran_qty opmcmmts.

        seta:
        do on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.

           set opm_desc opm_wkctr opm_mch opm_setup opm_run
           opm_move opm_yld_pct opm_tool opm_vend
/*G689*/           opm_mile
/*GB32*/           opm_inv_val
           opm_sub_cost opm_sub_lead opm_tran_qty opmcmmts
           go-on ("F5" "CTRL-D" ).

           /* DELETE */
           if lastkey = keycode("F5")
           or lastkey = keycode("CTRL-D")
           then do:
          del-yn = yes.
          {mfmsg01.i 11 1 del-yn}
          if del-yn = no then undo seta.

/*GM49*/      for each cmt_det exclusive-lock where cmt_indx = opm_cmtindx:
             delete cmt_det.
          end.

          delete opm_mstr.
          clear frame a.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
          del-yn = no.
          next mainloop.
           end.

           if not can-find (wc_mstr where wc_wkctr = opm_wkctr
           and wc_mch = opm_mch)
           then do:
          {mfmsg.i 528 3}
          next-prompt opm_mch.
          undo, retry.
           end.

/*J2V1** /*G740*/ {fswcv.i &fld=opm_wkctr &type=2 &cmd="next-prompt opm_wkctr."}      */

/*J2V1*/  if can-find (wc_mstr where wc_wkctr = opm_wkctr and
/*J2V1*/               wc_fsm_type = "FSM")
/*J2V1*/  then do:
/*J2V1*/     {mfmsg.i 7485 2}
/*J2V1*/     next-prompt opm_wkctr.
/*J2V1*/     undo, retry.
/*J2V1*/  end.

/*J04C*        ADDED THE FOLLOWING */
           if opm_vend entered and opm_vend <> " " then do:
           find vd_mstr where vd_addr = opm_vend
               no-lock no-error.
           if not available vd_mstr then do:
            {mfmsg.i 2 2}
            /* NOT A VALID SUPPLIER */
           end. /* if not available vd_mstr */
           end. /* if opm_vend entered */
/*J04C*        END ADDED CODE */
           if opmcmmts = yes then do:
          global_ref = string(opm_std_op).
          cmtindx = opm_cmtindx.
          {gprun.i ""gpcmmt01.p"" "(input ""opm_mstr"")"}
/*GUI*/ if global-beam-me-up then undo, leave.

          opm_cmtindx = cmtindx.
          global_ref = "".
           end.
        end.
/*GUI*/ if global-beam-me-up then undo, leave.

     end.
/*GUI*/ if global-beam-me-up then undo, leave.


     status input.
